<?php
	header("Content-type: text/html;charset=utf8");
	require_once("../db/dbclass.php");
	require_once("../utils/common.php");
	$myDb=&DbController::getInstance();
	$tweet_id="";
	if (isset($_POST['tweet_id'])) {
		$tweets_id=$_POST['tweet_id'];
	}
	$param="SELECT * FROM yj_tweets_comment where tweets_id='".$tweets_id."'";
	$result=$myDb->exec_query($param);
	if($result==TRUE){
		$row_num = mysqli_num_rows($result);
		$array_all=array($row_num);
		$i=0;
		while($row=mysqli_fetch_array($result,MYSQL_ASSOC)){
			$array_i=array(
					"comment_id"=>$row['comment_id'],
					"friend_id"=>$row['user_id'],
					"tweet_id"=>$row['tweets_id'],
					"comment_content"=>$row['comment_content'],
					"comment_time"=>$row['comment_time'],
					);
			$array_all[$i++]=$array_i;
		}
		$arr=array(
			"result"=>"success",
			"comments"=>$array_all
		);
		echo json_encode($arr);
		return;
	}
	$arr=array(
			"result"=>"failure",
			"comments"=>""
		);
	echo json_encode($arr);
?>